import http from '@/components/common/tui-request'


//获取检查人员下拉列表名单
export const getQualityMemberNameList = (projectId) => {
	return http.request({
		url: `/quality/getQualityMemberNameList/${projectId}`,
		method: 'GET',
	});
};

//获取质量检查列表
export const getQualityList = (projectId,page,limit) => {
	return http.request({
		url: `/quality/getQualityList/${projectId}/${page}/${limit}`,
		method: 'GET',
	});
};


//获取检查分类名称下拉菜单列表
export const getQualityTypeList = () => {
	return http.request({
		url: `/quality/getQualityTypeList`,
		method: 'GET',
	});
};

//新增质量检查
export const addQuality = (projectId,data) => {
	return http.request({
		url: `/quality/addQuality/${projectId}`,
		data:data,
		method: 'POST',
	});
};

//上传质量检查附件
export const uploadQualityAttach = (file) => {
	return uni.uploadFile({
		url: 'http://192.168.1.127:8086/quality/uploadQualityAttach',
		filePath: file.objectUrl,
		name: 'files',
		header: {'Authorization': uni.getStorageSync('token')}
	});
};

//删除质量检查附件
export const deleteQualityFile = (fileId) => {
	return http.request({
		url: `/quality-file/deleteQualityFile/${fileId}`,
		method: 'DELETE',
	});
};
export const deleteQualityFile2 = (fileIds) => {
	return http.request({
		url: `/quality-file/deleteQualityFile?fileIds=${fileIds}`,
		method: 'DELETE',
	});
};

//根据id查看详情
export const selectQualityById = (qualityId) => {
	return http.request({
		url: `/quality/selectQualityById?qualityId=${qualityId}`,
		method: 'GET',
	});
};

//根据id回显数据
export const getQualityById = (qualityId) => {
	return http.request({
		url: `/quality/getQualityById?qualityId=${qualityId}`,
		method: 'GET',
	});
};

//删除未合格质量检查
export const deleteQuality = (qualityId) => {
	return http.request({
		url: `/quality/deleteQuality/${qualityId}`,
		method: 'DELETE',
	});
};

//编辑质量检查
export const updateQuality = (data) => {
	return http.request({
		url: `/quality/updateQuality`,
		data:data,
		method: 'PUT',
	});
};